import { service } from "../http/request";

/**
 * 获取工作台任务信息
 */
const workInfo = () => {
  return service({
    method: 'get',
    url: '/task/wrokInfo'
  })
}

/**
 * 获取当前用户的指定状态任务
 */
const myStatusTask = (status) => {
  return service({
    method: 'get',
    url: `/task/wrok/getTask/${status}`
  })
}

/**
 * 获取所有用户的指定状态任务
 */
const allStatusTask = (id) => {
  return service({
    method: 'get',
    url: `/task/allStatusTask/${id}`
  })
}


/**
 * 获取任务详情信息
 */
const getTaskDetail = (id) => {
  return service({
    method: 'get',
    url: `/task/work/${id}`
  })
}

/**
 * 更改任务信息
 */
const updateTaskInfo = (params) => {
  return service({
    method: 'put',
    url: '/task/',
    data: params
  })
}

/**
 * 获取所有任务信息
 */
const getAllTask = (currentPage,size,creater, designee) => {
  return service({
    method: 'get',
    url: `/task/admin/list?creater=${creater}&designee=${designee}&currentPage=${currentPage}&size=${size}`
  })
}

/**
 * 获取我发布的任务
 */
const myPublishTask = (currentPage,size,status) => {
  return service({
    method: 'get',
    url: `/task/admin/myPublishTask?status=${status}&currentPage=${currentPage}&size=${size}`
  })
}

/**
 * 获取指派我的任务
 */
const getDesTask = (currentPage,size,status) => {
  return service({
    method: 'get',
    url: `/task/admin/getDesTask?status=${status}&currentPage=${currentPage}&size=${size}`
  })
}

/**
 * 添加任务
 */
const addTask = (params) => {
  return service({
    method: 'post',
    url: '/task/',
    data: params
  })
}

/**
 * 更改任务信息
 */
const updateTask = (param) => {
  return service({
    method: 'put',
    url: '/task/',
    data: param
  })
}

/**
 * 删除任务信息
 */
const delTasl = (id) => {
  return service({
    method: 'delete',
    url: `/task/${id}`
  })
}

/**
 * 任务统计
 */
const taskStatistics = () => {
  return service({
    method: 'get',
    url: '/task/taskStatistics',
  })
}


export default {
  workInfo,
  getTaskDetail,
  updateTaskInfo,
  myStatusTask,
  allStatusTask,
  getAllTask,
  myPublishTask,
  getDesTask,
  addTask,
  updateTask,
  delTasl,
  taskStatistics
}
